#!/usr/bin/python
#-*- coding: utf-8 -*-

###########################################################
# Copyright 2011 Daniel 'grindhold' Brendle and Team
#
# This file is part of Kitchen of Awesome.
#
# Kitchen of Awesome is free software: you can redistribute it and/or 
# modify it under the terms of the GNU General Public License 
# as published by the Free Software Foundation, either 
# version 3 of the License, or (at your option) any later 
# version.
#
# Kitchen of Awesome is distributed in the hope that it will be 
# useful, but WITHOUT ANY WARRANTY; without even the implied 
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
# PURPOSE. See the GNU General Public License for more details.
#
# You should have hreceived a copy of the GNU General Public 
# License along with Kitchen of Awesome. 
# If not, see http://www.gnu.org/licenses/.
###########################################################

import pymongo
import data
import gui

#from special import A,B

class Application():
	def __init__(self):
		con = pymongo.Connection()
		koadb = con.koa
		self.storage = koadb.storage
		data.setApplicationReference(self)

	def getStorage(self):
		return self.storage


	def run(self):
		from data.user import User
		from data.note import Note
		u = User()
		d = User()
		a = User()
		d.firstname = 'Daniel'
		d.lastname = 'Brendle'
		d.store()
		u.firstname = 'Fabian'
		u.lastname = 'Eberhard'
		u.mitbewohner = d
		ident = u.store()

		res = Note.createNote(d,[d,u],"benis in bagina")
		print "RES"+repr(res)

		res2 = Note.getNotesForUser(d)
		print "RES2"+repr(res2)
		print res2[0].getContent()


		res3 = Note.getNotesForUser(u)
		print "RES2"+repr(res3)
		print res3[0].getContent()

		del(u)
		del(d)
		del(res[0])

app = Application()
app.run()